home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 November
/
EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso
/
earcd
/
comm
/
tatriv12.lha
/
rexx
/
TATRIVIA.TRANS
Wrap
Text File
|
1995-07-18
|
10KB
|
412 lines
/* $VER: TA-Trivia v1.2 (7/16/95) for TransAmiga by John Kratz
Fidonet 1:2608/22.0, Internet jkratz@erc.cat.syr.edu
*/
/*
This program may be freely distributed by and among sysops using any BBS
software, so long as those persons have never denied anyone use of any
software they have written or modified because of BBS software type.
*/
options results
signal on syntax
signal on error
signal on ioerr
oneright=0 /* Number of minutes to add for 1 right answers */
tworight=0 /* Number of minutes to add for 2 right answers */
threeright=0 /* Number of minutes to add for 3 right answers */
fourright=5 /* Number of minutes to add for 4 right answers */
fiveright=5 /* Number of minutes to add for 5 right answers */
sixright=5 /* Number of minutes to add for 6 right answers */
sevenright=5 /* Number of minutes to add for 7 right answers */
eightright=10 /* Number of minutes to add for 8 right answers */
nineright=10 /* Number of minutes to add for 9 right answers */
tenright=20 /* Number of minutes to add for 10 right answers */
total=278 /* total number of question files available */
ui=userinfo;tr=transmit;gc=getchar;ss=sendstring;si=systeminfo
ui a;handle=result
ui a;name=result
ui o;access=result
si m;timeallowed=(result-3)
bbsidentify 'name';bbsname=result
test=bbsname;namecount=length(test)
spacenum=59-namecount
spaces=" ";spaces1=" "
do i=1 to spacenum
spaces=spaces||spaces1
end
ver="TA Trivia v1.2"
bbsidentify 'sysop';sysopname=result
bbsidentify bbs ; bbsversion=result
bbstype=left(bbsversion,4)
Highscores="BBS:Extras/TATRIVIA/Highscores.txt"
c=0
setnodelocation "Playing the Trivia game!"
sysoplog name 'played the Trivia Game!'
if bbstype="Tran" then do
bbs="T"
Games='BBS:Extras/'
USERINFO x ; ansi = RESULT
CSI = '1b'x||'['
if ansi='ON' then do
OFF = CSI'0;37m'
RED = CSI'31m'
GREEN = CSI'32m'
YELLOW = CSI'33m'
BLUE = CSI'34m'
PURPLE = CSI'35m'
CYAN = CSI'36m'
WHITE = CSI'37m'
yellowback = CSI'43m'
greenback = CSI'42m'
blueback = CSI'44m'
END
ELSE DO
OFF = ''
RED = ''
GREEN = ''
YELLOWOW = ''
BLUE = ''
PURPLE = ''
CYAN = ''
WHITE = ''
END
default = ""
end
path=games"TaTrivia/"
upath=path"users/"
qpath=path"Questions/"
quest="Questions"
high=games path"HighScores.txt"
index=1
check=1
used.1=0
START:
INST:
ss green
sendfile path"Inst"bbs
address command 'WAIT 3 secs'
TITLESCREEN:
cls
sendstring OFF
sendfile path"title"bbs
bufferflush
tr ''
MAIN:
tr center('
[
V
]
iew High Scores',100)
tr center('
[
P
]
lay TA Trivia',99)
tr center('
[
Q
]
uit',89)
ss '
Your Choice?
' ; gc ;ans=upper(ans) ; call GCCHECK
if ans='P' then do
cls
call STARTOVER
end
if ans='V' then do
cls
call SHOWHIGHS
continue
call TITLESCREEN
end
if ans='Q' then signal QUIT
if ans='RESULT' then cls ; signal TITLESCREEN
STARTOVER:
num=1;count=1
score=0
timenumb=0
listnum=random(1,total,66)
GETQUESTIONS:
listnum=random(1,total,time('s'))
do i=1 to check
if used.i=listnum then signal GETQUESTIONS
end
used.index=listnum
check=index
index=index+1
if index=276 then do
do i=1 to check
used.i=0
end
index=1
check=1
end
if open('file',qpath||quest||listnum,'R') then do
do until EOF('file')
quest.num=readln('file')
do i=1 to 4
quest.num.i=readln('file')
end
num=num+1
end
call close('file')
end
else do
tr "There has been a problem loading the question file"
exit 10
end
SHOW:
cls
if count=num-1 then signal SHUTDOWN
tr ""
tr ""
ss BLUE bbsname"'s "RED"Trivia Quiz"spaces""
tr ""
tr yellowback Green ver "by John Kratz of Amiga Time BBS! "OFF
tr " "
if access = 255 then do
ss green "Question File number:" yellow listnum" "
end
tr green "Question number:" yellow count
tr " "
tr CYAN quest.count Yellow
tr ""
do i=1 to 4
parse var quest.count.i isans 2 answer
if isans="!" then theans=i
if isans~="-" then transmit i"" answer
end
bufferflush
tr ''
tr Red"You have "score" right."
tr ''
ss Purple"Your Choice ->
";gc;
ASKIT:
guess=upper(result)
tr cyan guess
if guess="1" then signal CONTINUE
if guess="2" then signal CONTINUE
if guess="3" & if isans~="-" then signal CONTINUE
if guess="4" & if isans~="-" then signal CONTINUE
if guess="Q" then signal SHUTDOWN
if guess="RESULT" then SIGNAL MAIN2
if guess="q" then do
guess=upper(guess)
signal SHUTDOWN
end
if guess~= "1" or guess ~= "2" or guess ~= "3" or guess ~= "4" or guess ~= "RESULT" then SIGNAL MAIN2
if guess="###PANIC" then signal exit 10
if guess="###panic" then signal exit 10
signal ASKIT
MAIN2:
Query Purple"FYour Choice ->
"
signal ASKIT
CONTINUE:
if guess=theans then do
score=score+1
tr CYAN" Correct."
end
else tr RED" Sorry, that's wrong."
address command 'WAIT 1 secs'
count=count+1
if count>num then do
if guess=theans then do
tr CYAN"Correct."
end
else tr RED"Sorry, that's wrong."
address command 'WAIT 1 secs'
signal SHUTDOWN
end
signal SHOW
GCCHECK:
ans=result
if ans ='###PANIC' then do ; bufferflush ; exit 10 ; end
return
SHOWHIGHS:
call READHIGH
call SHOWFIVE
return
CHECKHI:
call READHIGH
x=0 ; gp=c ; if gp<=0 then signal L288
L276:
x=x+1 ; if x>10 then signal L288
z=10 ; if zp.x.2=0 then signal L283
if gp<zp.x.2 then signal L276
L283:
z1=z-1
do y=1 to 3
zp.z.y=zp.z1.y
end y
z=z-1 ; if z~<x then signal L283
zp.x.1=handle ; zp.x.2=gp ;zp.x.3=date()
tr "
Congratulations! You Are One Of The Top 10 Players!"
call open(f1,HIGHSCORES,'w')
do x=1 to 10
do y=1 to 3
call writeln(f1,zp.x.y)
end y
end x ; call close(f1)
if gs=0 then cls ; call SHOWHIGHS
call WAIT
return
L288:
tr "
Sorry, You Did Not Make It In The Top Ten. Try Again Next Time.
"
address command 'WAIT 2 secs'
SIGNAL ANOTHER
return
READHIGH:
if ~exists(HighScores) then do
call open(f1,HighScores,'w')
do x=1 to 10
call writeln(f1,"Nobody Yet!") ; call writeln(f1,"0") ; call writeln(f1,"None Yet!!!")
end x ; call close(f1)
end
call open(f1,HighScores,'r')
do x=1 to 10
do y=1 to 3
zp.x.y=readln(f1)
end y
end x ; call close(f1)
return
SHOWFIVE:
tr '
ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»'
tr ' º TA
Trivia
High Scores!
º'
tr ' º
Current Top
Ten
TA
Trivia
Champs:C
º'
tr ' ºCº'
tr ' º NAMEC
TOTAL SCORE!C
DATEC
º'
tr ' ºCº'
do x=1 to 10
tr ' º'right('<'||x||'>',4)'
'||left(zp.x.1' ',20)'
'right(zp.x.2,2)' C
'right(zp.x.3,11)'
º'
end x
tr ' ºCº'
tr ' ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ'
return
SHUTDOWN:
give=0
si m ; ontime=result
si q ; maxtime=result
if score=0 then SIGNAL L288
if count>9 & score>0 then do
if score=1 then do
tr blue'Although you made it into the TOP TEN, you must score 4 or more correct'
tr 'to win extra online time.'
address command 'Wait 2 secs'
SIGNAL CHECKHI
end
if score=2 then do
tr blue'Although you made it into the TOP TEN, you must score 4 or more correct'
tr 'to win extra online time.'
address command 'Wait 2 secs'
SIGNAL CHECKHI
end
if score=3 then do
tr blue'Although you made it into the TOP TEN, you must score 4 or more correct'
tr 'to win extra online time.'
address command 'Wait 2 secs'
SIGNAL CHECKHI
end
if score=4 then do
newtime = ontime + fourright
settime newtime
timenumb=fourright
c=4
end
if score=5 then do
newtime = ontime + fiveright
settime newtime
timenumb=fiveright
c=5
end
if score=6 then do
newtime = ontime + sixright
settime newtime
timenumb=sixright
c=6
end
if score=7 then do
newtime = ontime + sevenright
settime newtime
timenumb=sevenright
c=7
end
if score=8 then do
newtime = ontime + eightright
settime newtime
timenumb=eightright
c=8
end
if score=9 then do
newtime = ontime + nineright
settime newtime
timenumb=nineright
c=9
end
if score=10 then do
newtime = ontime + tenright
settime newtime
timenumb=tenright
c=10
end
end
if count >9 then tr green"You have been given "timenumb" extra minutes online for your "score" correct answers."
if timenumb>0 then do
si m ; ontime=result
si q ; maxtime=result
setnewtime = ontime + timenumb
tr 'Your OLD time remaining is:' ontime 'minutes'
tr 'Your New time remaining is:' setnewtime 'minutes'
if setnewtime>maxtime then do
setnewtime=maxtime
tr 'Sorry, you can only have 'maxtime 'minutes/day total'
end
continue
settime setnewtime
end
give=1
SIGNAL CHECKHI
if give=0 then ss
ANOTHER:
tr''
ss WHITE"Would you like to try another quiz? "cyan"("green"y"cyan"/"red"N"cyan") "green;gc;again=upper(result)
if again="Y" then do
tr "Yes"
signal STARTOVER
end
tr ""
tr green"Returning you to "bbsname"."
address command 'Wait 2 sec'
cls
exit 10
WAIT:
bufferflush ; continue ;cls ; return
QUIT:
cls
Tr 'Thank you' name 'for playing TA Trivia!'
bufferflush ; exit 10
ERROR:
IOERR:
SYNTAX:
transmit "Error in "ver". Line: "SIGL
transmit "Error: "RCALL errortext(RC)
transmit "Please notify "sysopname"!"
transmit "Returning to "BBSname"..."
LOGENTRY "Error in "ver". Line: "SIGL
LOGENTRY "Error: "RCALL errortext(RC)
BUFFERFLUSH
END
EXIT 10